<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        button{
            border: none;
            border-radius: 4px;
        }
        #app{
            margin: 10px;
        }
        .input-box{
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
        }
        .input-box>input{
            border: none;
            outline: none;
            border-radius: 20px;
            width: 80%;
            height: 30px;
            background-color: #f5f5f5;
            padding: 10px;
            box-sizing: border-box;
        }
        .suammry{
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
        }
        .suammry>span{
            background-color: aquamarine;
            line-height: 20px;
            padding: 6px;
            border-radius: 5px;
        }
        .box .task{
            line-height: 40px;
            background-color: aquamarine;
            position: relative;
            margin-bottom: 10px;
        }
        .box .task>button{
            position: absolute;
            right: 16px;
            top:10px;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 输入框 -->
        <div class="input-box">
            <input type="text" placeholder="输入任务名称" v-model="taskName"> 
            <button @click="addTask">新增</button>
        </div>
        <!-- 统计任务 -->
        <div class="suammry">
            <span>全部任务( {{taskList.length}} )</span>
            <span>已完成( {{taskList.length-unfinshCount}} )</span>
            <span>未完成( {{unfinshCount}} )</span>
        </div>
        <!-- 任务列表 -->
        <div class="box">
            <h3>任务列表</h3>
            <div class="list">
                <div class="task" v-for="(item,index) in taskList">
                    <!-- 
                        :checked="item.status" 添加新任务后的状态
                        @click="changeStatus(item)"当点击复选框按钮时取反
                     -->
                    <span><input @click="changeStatus(item)" type="checkbox" :checked="item.status"></span>
                    <span>{{item.sn}}</span>
                    <span>{{item.name}}</span>
                    <!-- 
                        删除任务
                     -->
                    <button @click="deleteTask(index)">删除</button>
                </div>
                
            </div>
        </div>
    </div>
</body>
</html>
<script src="../vue-2.5.21.js"></script>
<script src="./04_toDoList.js"></script>